﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VietPublisher.BaseProject.Models.cart
{
    /// <summary>
    /// This CartItem display whole item of a cart
    /// </summary>
    public class CartItem
    {
        #region contructor
        public CartItem(int bookID , String bookCode ,String itemName,int quantity , double price ) {
            this.BookID = bookID;
            this.BookCode = bookCode;
            this.ItemName = itemName;
            this.Quantity = quantity;
            this.Price = price;
            this.Total = quantity * price;        
        }
        public CartItem()
        {
           // this.items.Clear();
            this.ItemName = string.Empty;
            this.Quantity = 0;
            this.Price = 0;
            this.Total = 0;
            this.BookCode = string.Empty;
        }
        #endregion

        public String BookCode { get; set; }
        public int BookID { get; set; }
        public String ItemName { get; set; }
        public int Quantity { get; set; }
        public double Price { get; set; }
        public double Total { get; set; }

        public void UpdateQuantity(int quantity) {
            this.Quantity = quantity;
            this.Total = Price * Quantity;
        }


    }
}
